<p>The MockServer allows the verification of requests by specifying:</p>
<ul>
    <li>a <a href="/mock_server/getting_started.html#request_matchers"><strong>request matcher</strong></a> and a count indicating the number of times the request should be matched</li>
	<li>a sequence of <a href="/mock_server/getting_started.html#request_matchers"><strong>request matchers</strong></a> that is matched in order</li>
</ul>

<h3>Verifying Repeating Requests</h3>

<p>Verify that a request has been received by MockServer a specific number of times using a <strong>Verification</strong></p>

<button id="button_verify_req" class="accordion title"><strong>Verify Repeating Requests Code Examples</strong></button>
<div class="panel title">
<button id="button_verify_req_at_least_twice" class="accordion">verify requests received at least twice</button>
<div class="panel">
    <button class="accordion inner">Java</button>
    <div class="panel">
        <pre class="prettyprint lang-java code"><code class="code">new MockServerClient("localhost", 1080)
    .verify(
        request()
            .withPath("/some/path"),
        VerificationTimes.atLeast(2)
    );</code></pre>
    </div>
    <button class="accordion inner">JavaScript</button>
    <div class="panel">
            <pre class="prettyprint lang-javascript code"><code class="code">var mockServerClient = require('mockserver-client').mockServerClient;
mockServerClient("localhost", 1080)
  .verify(
    {
      'path': '/some/path'
    }, 2, false)
  .then(
    function () {
      console.log("request found exactly 2 times");
    },
    function (error) {
      console.log(error);
    }
  );</code></pre>
    </div>
    <button class="accordion inner">REST API</button>
    <div class="panel">
            <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/verify" -d '{
    "httpRequest": {
        "path": "/simple"
    },
    "times": {
        "atLeast": 2
    }
}'</code></pre>
    </div>
</div>
<button id="button_verify_req_exact_once" class="accordion">verify requests received exact once</button>
<div class="panel">
    <button class="accordion inner">Java</button>
    <div class="panel">
        <pre class="prettyprint lang-java code"><code class="code">new MockServerClient("localhost", 1080)
    .verify(
        request()
            .withPath("/some/path"),
        VerificationTimes.once()
    );</code></pre>
    </div>
    <button class="accordion inner">JavaScript</button>
    <div class="panel">
            <pre class="prettyprint lang-javascript code"><code class="code">var mockServerClient = require('mockserver-client').mockServerClient;
mockServerClient("localhost", 1080)
  .verify(
    {
      'path': '/some/path'
    }, 1, true)
  .then(
    function () {
      console.log("request found exactly 1 times");
    },
    function (error) {
      console.log(error);
    }
  );</code></pre>
    </div>
    <button class="accordion inner">REST API</button>
    <div class="panel">
            <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/verify" -d '{
    "httpRequest": {
        "path": "/simple"
    },
    "times": {
        "atLeast": 1,
        "atMost": 1
    }
}'</code></pre>
    </div>
</div>
<button id="button_verify_req_never_received" class="accordion">verify requests never received</button>
<div class="panel">
    <button class="accordion inner">Java</button>
    <div class="panel">
        <pre class="prettyprint lang-java code"><code class="code">new MockServerClient("localhost", 1080)
    .verify(
        request()
            .withPath("/some/path"),
        VerificationTimes.exactly(0)
    );</code></pre>
    </div>
    <button class="accordion inner">JavaScript</button>
    <div class="panel">
            <pre class="prettyprint lang-javascript code"><code class="code">var mockServerClient = require('mockserver-client').mockServerClient;
mockServerClient("localhost", 1080)
  .verify(
    {
      'path': '/some/path'
    }, 0, true)
  .then(
    function () {
      console.log("request found zero times");
    },
    function (error) {
      console.log(error);
    }
  );</code></pre>
    </div>
    <button class="accordion inner">REST API</button>
    <div class="panel">
            <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/verify" -d '{
    "httpRequest": {
        "path": "/simple"
    },
    "times": {
        "atMost": 0
    }
}'</code></pre>
    </div>
</div>
</div>

<h3>Verifying Request Sequences</h3>

<p>Verify that a sequence of requests has been received by MockServer in the specified order using a <strong>VerificationSequence</strong></p>

<p>The each request in the sequence will be verified to have been received at least once, in the exact order specified.</p>

<button id="button_verify_sequence" class="accordion title"><strong>Verify Request Sequences Code Examples</strong></button>
<div class="panel title">
<button id="button_verify_sequence_of_reqs" class="accordion">verify request sequence received</button>
<div class="panel">
    <button class="accordion inner">Java</button>
    <div class="panel">
            <pre class="prettyprint lang-java code"><code class="code">new MockServerClient("localhost", 1080)
    .verify(
        request()
            .withPath("/some/path/one"),
        request()
            .withPath("/some/path/two"),
        request()
            .withPath("/some/path/three")
    );</code></pre>
    </div>
    <button class="accordion inner">JavaScript</button>
    <div class="panel">
            <pre class="prettyprint lang-javascript code"><code class="code">var mockServerClient = require('mockserver-client').mockServerClient;
mockServerClient("localhost", 1080)
  .verifySequence(
    {
      'path': '/some/path/one'
    },
    {
      'path': '/some/path/two'
    },
    {
      'path': '/some/path/three'
    }
  )
  .then(
    function () {
      console.log("request sequence found in the order specified");
    },
    function (error) {
      console.log(error);
    }
  );</code></pre>
    </div>
    <button class="accordion inner">REST API</button>
    <div class="panel">
            <pre class="prettyprint code"><code class="code">curl -v -X PUT "http://localhost:1080/mockserver/verifySequence" -d '{
   "httpRequests":[
      {
         "path":"/some/path/one"
      },
      {
         "path":"/some/path/two"
      },
      {
         "path":"/some/path/three"
      }
   ]
}'</code></pre>
    </div>
</div>
</div>
